package com.ruoyi.wechat.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.wechat.mapper.CommentsMapper;
import com.ruoyi.wechat.domain.Comments;
import com.ruoyi.wechat.service.ICommentsService;

/**
 * 评论Service业务层处理
 * 
 * @author yeluochen
 * @date 2024-12-24
 */
@Service
public class CommentsServiceImpl implements ICommentsService 
{
    @Autowired
    private CommentsMapper commentsMapper;

    /**
     * 查询评论
     * 
     * @param  commentsId 评论主键
     * @return 评论
     */
    @Override
    public Comments selectCommentsByCommentsId(String commentsId)
    {
        return commentsMapper.selectCommentsByCommentsId(commentsId);
    }

    /**
     * 查询评论列表
     * 
     * @param comments 评论
     * @return 评论
     */
    @Override
    public List<Comments> selectCommentsList(Comments comments)
    {
        return commentsMapper.selectCommentsList(comments);
    }

    /**
     * 新增评论
     * 
     * @param comments 评论
     * @return 结果
     */
    @Override
    public int insertComments(Comments comments)
    {
        comments.setCommentsId(IdUtils.randomUUID());
        comments.setCreateTime(DateUtils.getNowDate());
        comments.setCommentsStatus(1l);
        return commentsMapper.insertComments(comments);
    }

    /**
     * 修改评论
     * 
     * @param comments 评论
     * @return 结果
     */
    @Override
    public int updateComments(Comments comments)
    {
        return commentsMapper.updateComments(comments);
    }

    /**
     * 批量删除评论
     * 
     * @param  commentsIds 需要删除的评论主键
     * @return 结果
     */
    @Override
    public int deleteCommentsByCommentsIds(String[] commentsIds)
    {
        return commentsMapper.deleteCommentsByCommentsIds(commentsIds);
    }

    /**
     * 删除评论信息
     * 
     * @param  commentsId 评论主键
     * @return 结果
     */
    @Override
    public int deleteCommentsByCommentsId(String commentsId)
    {
        return commentsMapper.deleteCommentsByCommentsId(commentsId);
    }
}
